<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>列表</title>
    <link rel="stylesheet" href="../static/css/styles.css" />
    <link rel="stylesheet" href="../static/css/font-awesome-4.7.0/css/font-awesome.min.css" />
    <script src="../static/js/jquery.min.js" type="text/javascript"></script>
</head>

<body>
    <script>
        function delcfm(p) {
            var r = confirm("确认删除该信息？");
            if (r == true) {

                var sno = p.parentNode.parentNode.children[0].innerHTML;
                var xml = new XMLHttpRequest();
                xml.open("get", "http://127.0.0.1:8080/delestu/" + sno, true);
                // xml.onreadystatechange = function () {
                //
                // };
                xml.send();
                // xml.send("callback=functionName");
                alert("删除成功");
                window.location.href = '{{url_for('studentlist')}}';
            } else
                alert("信息未删除");
        }

        function delcf(p) {

            var sno = p.parentNode.parentNode.children[0].innerHTML;
            window.localStorage.setItem('imge0', sno);
            location.href = '{{url_for('studentgai')}}';
            sno = p.parentNode.parentNode.children[1].innerHTML,
                window.localStorage.setItem('imge1', sno);
            location.href = '{{url_for('studentgai')}}';
            sno = p.parentNode.parentNode.children[2].innerHTML,
                window.localStorage.setItem('imge2', sno);
            location.href = '{{url_for('studentgai')}}';
            sno = p.parentNode.parentNode.children[3].innerHTML,
                window.localStorage.setItem('imge3', sno);
            location.href = '{{url_for('studentgai')}}';
            sno = p.parentNode.parentNode.children[4].innerHTML,
                window.localStorage.setItem('imge4', sno);
            location.href = '{{url_for('studentgai')}}';
            sno = p.parentNode.parentNode.children[5].innerHTML,
                window.localStorage.setItem('imge5', sno);
            location.href = '{{url_for('studentgai')}}';
            window.localStorage.setItem('imge', sno);
            location.href = '{{url_for('studentgai')}}';

        }

    </script>
    <div class="condition">
        <form action="{{ url_for('studentlistse') }}" method="post" enctype="multipart/form-data">
            学号<input type="text" name="sno"> 系：
            <input type="text" name="sdept"> 年级：
            <input type="text" name="sgrade">
            <button>
				<i class="fa fa-search" type="submit"></i>
				<input type="submit" value="查询">

			</button>
        </form>
        <button onclick="window.location.href='{{url_for('studentadd')}}'">
				<i class="fa fa-plus"></i>
				新增
			</button>
    </div>
    <table class="tablelist">
        <thead>
            <tr>
                <th>学号</th>
                <th>账号密码</th>
                <th>学生姓名</th>
                <th>年龄</th>
                <th>系</th>
                <th>年级</th>
                <th width="120px">操作</th>
            </tr>
        </thead>

        {% for v in stu_info %}
        <tr>
            <td>{{v[0]}}</td>
            <td>{{v[1]}}</td>
            <td>{{v[2]}}</td>
            <td>{{v[3]}}</td>
            <td>{{v[4]}}</td>
            <td>{{v[5]}}</td>
            <td>
                <button class="edit" onclick=delcf(this)>
                    修改
                </button>
                <button class="remove" id="dsad" onclick=delcfm(this)>
							<i class="fa fa-remove"></i>
							删除
						</button>
            </td>
        </tr>
        {% endfor %}

    </table>
    <table class="page">
        <td>
            <button>首页</button>
            <button>上一页</button>
            <button>下一页</button>
            <button>尾页</button>
            <input type="text" class="page-no" name="pageNo" />
            <button>转</button>
        </td>
    </table>
</body>

</html>